<?php

include 'include_file.php';

$db = new DBAccess();

/* $oldCates = $db->selectAll(array("cat_name", "keywords", "cat_desc" ), "ecs_category");

$n = 7;
foreach ($oldCates as $value) {
    $cate = array();
    
    $n++;
    
    $cate[CATEGORY_ID] = $n;
    $cate[CATEGORY_CODE] = "duongnv";
    $cate[CATEGORY_TITLE] = $value["cat_name"];
    $cate[CATEGORY_URL] = encodeURL($value["cat_name"]);
    $cate[CATEGORY_IMAGELINK] = "";
    $cate[CATEGORY_FID] = 0;
    $cate[CATEGORY_TYPE] = CATEGORY_TYPE_PRODUCT;
    $cate[CATEGORY_DESCRIPTION] = $value["cat_desc"];
    $cate[CATEGORY_TITLETAG] = $value["cat_name"];
    $cate[CATEGORY_METAKEYWORD] = $value["keywords"];
    $cate[CATEGORY_METADESCRIPTION] = $value["cat_desc"];
    $cate[CATEGORY_POSITION] = 1;
    $cate[CATEGORY_UPDATETIME] = getCurrentDateTime();
    $cate[CATEGORY_LANGUAGE] = "vn";
    $cate[CATEGORY_EDITBY] = "duongnv";
    
    echo $db->insertData($cate, CATEGORIES) . "<br />";
    updateDataType(CATEGORIES, $n, $cate[CATEGORY_URL]);
    
} */

/* $oldProducts = $db->selectManyByCause(array("goods_name", "market_price", "shop_price", "keywords", "goods_desc", "goods_img"), "ecs_goods", array("cat_id" => 118));


$n = $db->selectCountRecord(PRODUCTS);
foreach ($oldProducts as $value) {
    $newProduct = array();
    $n++;
    
    $newProduct[PRODUCT_ID] = $n;
    $newProduct[PRODUCT_URL] = encodeURL($value["goods_name"]);
    $newProduct[PRODUCT_TITLE] = $value["goods_name"];
    $newProduct[PRODUCT_PRODUCTCODE] = "THGPATIN";
    $newProduct[PRODUCT_MANUFACTURER] = "";
    $newProduct[PRODUCT_MANUFACTURERCODE] = "";
    $newProduct[PRODUCT_STATUS] = "";
    $newProduct[PRODUCT_WARRANTY] = "Bảo hành 1 năm, đổi mới trong  tuần đầu.";
    $newProduct[PRODUCT_QUANTITY] = 1;
    $newProduct[PRODUCT_COLOR] = "Nhiều màu";
    $newProduct[PRODUCT_COLORCODE] = "nhieu-mau";
    $newProduct[PRODUCT_SIZE] = "Tùy chỉnh";
    $newProduct[PRODUCT_TYPE] = "";
    $newProduct[PRODUCT_CATEGORYID] = 27;
    $newProduct[PRODUCT_IMAGELINK] = $value["goods_img"];
    $newProduct[PRODUCT_PRICE] = $value["shop_price"];;
    $newProduct[PRODUCT_CURRENCY] = "VND";
    $newProduct[PRODUCT_SHOWPRICE] = $value["market_price"];
    $newProduct[PRODUCT_SHOWCURRENCY] = "VND";
    $newProduct[PRODUCT_PROMOTION] = "Miễn phí vận chuyển trong nội thành. Giảm giá nếu đặt hàng với số lướng lớn.";
    $newProduct[PRODUCT_SPACEPRODUCT] = "";
    $newProduct[PRODUCT_HOTFEATURE] = "";
    $newProduct[PRODUCT_CONTENT] = $value["goods_desc"];
    $newProduct[PRODUCT_SPECIFICATION] = $value["goods_desc"];
    $newProduct[PRODUCT_HOT] = 1;
    $newProduct[PRODUCT_FESH] = 1;
    $newProduct[PRODUCT_TITLETAG] = $value["goods_name"];
    $newProduct[PRODUCT_METADESCRIPTION] = $value["goods_name"];
    $newProduct[PRODUCT_METAKEYWORD] = $value["goods_name"];
    $newProduct[PRODUCT_TAGKEYWORD] = "the gioi patin, giai patin chat luong cao, tu van mo san truot patin";
    $newProduct[PRODUCT_UPDATETIME] = getCurrentDateTime();
    $newProduct[PRODUCT_VIEWNUMBER] = 100;
    $newProduct[PRODUCT_LANGUAGE] = "vn";
    $newProduct[PRODUCT_EDITBY] = "duongnv";
    
    echo $db->insertData($newProduct, PRODUCTS). "<br />";
    updateDataType(PRODUCTS, $n, $newProduct[PRODUCT_URL]);
} */

// $product = $db->selectAll(array(PRODUCT_ID, PRODUCT_IMAGELINK), PRODUCTS);

// foreach ($product as $value) {
    
//     $value[PRODUCT_IMAGELINK] = str_replace("images/", "upload/images/san-pham/", $value[PRODUCT_IMAGELINK]);
//     $value[PRODUCT_IMAGELINK] = str_replace("goods_img/", "", $value[PRODUCT_IMAGELINK]);
    
//     echo $db->updateData($value, PRODUCTS). "<br />";
// }

/* $product = $db->selectAll(array(PRODUCT_ID, PRODUCT_CONTENT), PRODUCTS);

foreach ($product as $value) {
    
    $value[PRODUCT_CONTENT] = str_replace("thegioipatin.com", "thethaoduongpho.vn", $value[PRODUCT_CONTENT]);
    
    echo $db->updateData($value, PRODUCTS). "<br />";
} */

$a = 3; $b = 0;
$b = $a++;
$a = $b+++$a;


echo $b . " - " .  $a;



?>